<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Shift Register (TCPWM)</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__tcpwm__shiftreg.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#groups">API Reference</a>  </div>
  <div class="headertitle">
<div class="title">Shift Register (TCPWM)<div class="ingroups"><a class="el" href="group__group__tcpwm.html">TCPWM        (Timer Counter PWM)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<p>Driver API for Shift Register. </p>
<p>The functions and other declarations used in this part of the driver are in cy_tcpwm_shiftreg.h. You can also include cy_pdl.h to get access to all functions and declarations in the PDL.</p>
<p>Shift Register functionality shifts the counter value to the right. A shift register is used to apply a signal delay function which can be used eg: in detecting frequency shift keying (FSK) signals. A shift register is also used in parallel-in to serial-out data conversion and serial-in to parallel-out data conversion.</p>
<p>Features:</p><ul>
<li>16- or 32-bit Counter</li>
<li>2 compare (CC0/CC1) registers with double buffer.</li>
<li>Programmable Counter taps through PERIOD_BUFF register.</li>
<li>Line output generated from a XOR combination of all enabled counter taps (bit position) defined by PERIOD_BUFF.</li>
<li>Programmable Compare Register. Compare value can be swapped with a buffered compare value on comparison event.</li>
<li>Interrupt on Comparison match events (CC0_MATCH/CC1_MATCH).</li>
<li>Start, Reload, Stop, Shift, and Serial-in Inputs.</li>
<li>Comparison match and Line Outputs.</li>
<li>Line output can be output with invert polarity.</li>
</ul>
<dl class="section note"><dt>Note</dt><dd>Shift Register mode is available only in TCPWM Version 2</dd></dl>
<h1><a class="anchor" id="group_tcpwm_shiftreg_configuration"></a>
Configuration Considerations</h1>
<p>The Shift Register configuration can be divided to number of sequential steps listed below:</p><ul>
<li><a class="el" href="group__group__tcpwm__shiftreg.html#group_tcpwm_shiftreg_config">Configure Shift Register</a></li>
<li><a class="el" href="group__group__tcpwm__shiftreg.html#group_tcpwm_shiftreg_pins">Assign and Configure Pins</a></li>
<li><a class="el" href="group__group__tcpwm__shiftreg.html#group_tcpwm_shiftreg_clock">Assign Clock Divider</a></li>
<li><a class="el" href="group__group__tcpwm__shiftreg.html#group_tcpwm_shiftreg_enable">Enable Shift Register</a></li>
<li><a class="el" href="group__group__tcpwm__shiftreg.html#group_tcpwm_shiftreg_start">Start Shift Register</a></li>
</ul>
<h2><a class="anchor" id="group_tcpwm_shiftreg_config"></a>
Configure Shift Register</h2>
<p>To configure Shift Register, provide the configuration parameters in the <a class="el" href="structcy__stc__tcpwm__shiftreg__config__t.html">cy_stc_tcpwm_shiftreg_config_t</a> structure. The configuration structure can be modified through software, but if the configurator in ModusToolbox is used then the configuration structure will be updated with the users inputs. To initialize the driver, call <a class="el" href="group__group__tcpwm__functions__shiftreg.html#gac0b638d2ea8e28da947179477295d40b">Cy_TCPWM_ShiftReg_Init</a> function providing a pointer to the populated <a class="el" href="structcy__stc__tcpwm__shiftreg__config__t.html">cy_stc_tcpwm_shiftreg_config_t</a> structure.</p>
<div class="fragment"><div class="line"></div><div class="line">    <span class="comment">/* Scenario: Initialize the first (index = 0) of TCPWM 0 block</span></div><div class="line"><span class="comment">     * as Shift Register with configuration settings</span></div><div class="line"><span class="comment">     */</span></div><div class="line">    <a class="code" href="structcy__stc__tcpwm__shiftreg__config__t.html">cy_stc_tcpwm_shiftreg_config_t</a> shiftreg_config =</div><div class="line">    {</div><div class="line">       <span class="comment">/* .clockPrescaler       = */</span><a class="code" href="group__group__tcpwm__shiftreg__clk__prescalers.html#ga89e93424b4425747f2aae590ff093ead">CY_TCPWM_SHIFTREG_PRESCALER_DIVBY_1</a>,</div><div class="line">       <span class="comment">/* .tapsEnabled          = */</span>0x80000000UL,</div><div class="line">       <span class="comment">/* .compare0             = */</span>16384UL,</div><div class="line">       <span class="comment">/* .compareBuf0          = */</span>16384UL,</div><div class="line">       <span class="comment">/* .enableCompare0Swap   = */</span><span class="keyword">false</span>,</div><div class="line">       <span class="comment">/* .compare1             = */</span>16384UL,</div><div class="line">       <span class="comment">/* .compareBuf1          = */</span>16384UL,</div><div class="line">       <span class="comment">/* .enableCompare1Swap   = */</span><span class="keyword">false</span>,</div><div class="line">       <span class="comment">/* .interruptSources     = */</span><a class="code" href="group__group__tcpwm__interrupt__sources.html#gac57e8fe929cde0bb273a4c0a812639f2">CY_TCPWM_INT_ON_CC0</a>,                <span class="comment">/* Interrupt will rise on CC0 Match*/</span></div><div class="line">       <span class="comment">/* .invertShiftRegOut    = */</span><a class="code" href="group__group__tcpwm__shiftreg__output__invert.html#gad73b211488b406ff61935039e77eda1d">CY_TCPWM_SHIFTREG_INVERT_DISABLE</a>,   <span class="comment">/* Not inverted */</span></div><div class="line">       <span class="comment">/* .invertShiftRegOutN   = */</span><a class="code" href="group__group__tcpwm__shiftreg__output__invert.html#gad73b211488b406ff61935039e77eda1d">CY_TCPWM_SHIFTREG_INVERT_DISABLE</a>,   <span class="comment">/* Not inverted */</span></div><div class="line">       <span class="comment">/* .reloadInputMode      = */</span><a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>,               <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */</span></div><div class="line">       <span class="comment">/* .reloadInput          = */</span><a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">       <span class="comment">/* .startInputMode       = */</span><a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>,               <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */</span></div><div class="line">       <span class="comment">/* .startInput           = */</span><a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">       <span class="comment">/* .killInputMode        = */</span><a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>,               <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */</span></div><div class="line">       <span class="comment">/* .killInput            = */</span><a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">       <span class="comment">/* .shiftInputMode       = */</span><a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>,               <span class="comment">/* Set this input to LEVEL and 1 (high logic level) */</span></div><div class="line">       <span class="comment">/* .shiftInput           = */</span><a class="code" href="group__group__tcpwm__input__selection.html#ga7369f85b221bf7c70e1a580daa6a6bef">CY_TCPWM_INPUT_1</a>,                   <span class="comment">/* Shift Register will run forever */</span></div><div class="line">       <span class="comment">/* .serialInputMode      = */</span><a class="code" href="group__group__tcpwm__input__modes.html#ga6f8ffc8c36941d7d44290147032fd33b">CY_TCPWM_INPUT_LEVEL</a>,               <span class="comment">/* This input is NOT used, leave it in default state (CY_TCPWM_INPUT_LEVEL) */</span></div><div class="line">       <span class="comment">/* .serialInput          = */</span><a class="code" href="group__group__tcpwm__input__selection.html#ga86b8267d250e656f6e79fbd703bce944">CY_TCPWM_INPUT_0</a>,</div><div class="line">       <span class="comment">/* .shiftRegOnDisable    = */</span><a class="code" href="group__group__tcpwm__shiftreg__output__on__disable.html#ga10c408c65db9a112f19c387c7d70328a">CY_TCPWM_SHIFTREG_OUTPUT_HIGHZ</a>,     <span class="comment">/* Default High impedance mode*/</span></div><div class="line">       <span class="comment">/* .trigger0Event        = */</span><a class="code" href="group__group__tcpwm__output__trigger__modes.html#ga80297cac01044cbf8ea2af92c902da7e">CY_TCPWM_CNT_TRIGGER_ON_DISABLED</a>,   <span class="comment">/* Disable output trigger0 event generation*/</span></div><div class="line">       <span class="comment">/* .trigger1Event        = */</span><a class="code" href="group__group__tcpwm__output__trigger__modes.html#ga80297cac01044cbf8ea2af92c902da7e">CY_TCPWM_CNT_TRIGGER_ON_DISABLED</a>,   <span class="comment">/* Disable output trigger1 event generation*/</span></div><div class="line">    };</div><div class="line"></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_SHIFTREG_NUM   (0UL)</span></div><div class="line"></div><div class="line">    <span class="keywordflow">if</span> (<a class="code" href="group__group__tcpwm__enums.html#gga236beaba02c8a2a1c4eec981501e7270af9807d578257fa9f0d29cd86ef2c71ea">CY_TCPWM_SUCCESS</a> != <a class="code" href="group__group__tcpwm__functions__shiftreg.html#gac0b638d2ea8e28da947179477295d40b">Cy_TCPWM_ShiftReg_Init</a>(TCPWM0, MY_TCPWM_SHIFTREG_NUM, &amp;shiftreg_config))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Handle possible errors */</span></div><div class="line">    }</div><div class="line"></div></div><!-- fragment --> <h2><a class="anchor" id="group_tcpwm_shiftreg_pins"></a>
Assign and Configure Pins</h2>
<p>The dedicated TCPWM pins can be used. The HSIOM register must be configured to connect the block to the pins. Use the <a class="el" href="group__group__gpio.html">GPIO (General Purpose Input Output)</a> driver API to do that. </p><div class="fragment"><div class="line">    <span class="comment">/* Scenario: </span></div><div class="line"><span class="comment">     * Configure P0[4] as Shift Register Line Output.</span></div><div class="line"><span class="comment">     * Configure P0[5] as Shift Register Line Compliment Output.</span></div><div class="line"><span class="comment">     */</span></div><div class="line">    <a class="code" href="group__group__gpio__functions__init.html#gaf57c501727276013d3e8974a9fb7d0a7">Cy_GPIO_Pin_FastInit</a>(GPIO_PRT0, 4UL, <a class="code" href="group__group__gpio__drive_modes.html#gacebd8bea6222d742bdfbfd86dabab940">CY_GPIO_DM_STRONG_IN_OFF</a>, 0UL, P0_4_TCPWM0_LINE2);</div><div class="line">    <a class="code" href="group__group__gpio__functions__init.html#gaf57c501727276013d3e8974a9fb7d0a7">Cy_GPIO_Pin_FastInit</a>(GPIO_PRT0, 5UL, <a class="code" href="group__group__gpio__drive_modes.html#gacebd8bea6222d742bdfbfd86dabab940">CY_GPIO_DM_STRONG_IN_OFF</a>, 0UL, P0_5_TCPWM0_LINE_COMPL2);</div><div class="line"></div></div><!-- fragment --> <h2><a class="anchor" id="group_tcpwm_shiftreg_clock"></a>
Assign Clock Divider</h2>
<p>The clock source must be connected for proper operation. Any of the peripheral clock dividers could be used. Use the <a class="el" href="group__group__sysclk.html">SysClk (System Clock)</a> driver API to do that.</p>
<h2><a class="anchor" id="group_tcpwm_shiftreg_enable"></a>
Enable Shift Register</h2>
<p>Shift Register has to be enabled before starting</p>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Enable Shift Register */</span></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_SHIFTREG_NUM   (0UL)</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__shiftreg.html#ga66d1c366130d20469af69a2d41016727">Cy_TCPWM_ShiftReg_Enable</a>(TCPWM0, MY_TCPWM_SHIFTREG_NUM);</div></div><!-- fragment --> <h2><a class="anchor" id="group_tcpwm_shiftreg_start"></a>
Start Shift Register</h2>
<p>To start Shift Register operation <a class="el" href="group__group__tcpwm__functions__common.html#gaafe86ec440bec9a2c23392f289cc3a8b">Cy_TCPWM_TriggerStart_Single</a> API can be used.</p>
<div class="fragment"><div class="line">    <span class="comment">/* Scenario: Use software trigger to start Shift Register operation */</span></div><div class="line"><span class="preprocessor">    #define MY_TCPWM_SHIFTREG_NUM   (0UL)</span></div><div class="line"></div><div class="line">    <a class="code" href="group__group__tcpwm__functions__common.html#gaafe86ec440bec9a2c23392f289cc3a8b">Cy_TCPWM_TriggerStart_Single</a>(TCPWM0, MY_TCPWM_SHIFTREG_NUM);</div><div class="line"></div></div><!-- fragment --><table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="groups"></a>
API Reference</h2></td></tr>
<tr class="memitem:group__group__tcpwm__macros__shiftreg"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__macros__shiftreg.html">Macros</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__functions__shiftreg"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__functions__shiftreg.html">Functions</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:group__group__tcpwm__data__structures__shiftreg"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__tcpwm__data__structures__shiftreg.html">Data Structures</a></td></tr>
<tr class="separator:"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
